﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Carmall.Entity
{
    public class SafeType
    {
        public static int SafeInt(object o)
        {
            try
            {
                return Convert.ToInt32(o);
            }
            catch
            {
                return 0;
            }
        }

        public static string SafeString(object o)
        {
            try
            {
                return Convert.ToString(o);
            }
            catch
            {
                return "";
            }
        }

        public static DateTime SafeTime(object o)
        {
            try
            {
                return Convert.ToDateTime(o);
            }
            catch
            {
                return DateTime.MinValue;
            }
        }
    }
}
